package com.yanmaohu.yulia.bean;

/**
 * @author Bright Lee
 */
public final class StringFactor implements StringValueExpression {

    private int beginIndex;
    private int endIndex;
    private StringPrimary stringPrimary;
    private CollateClause collateClause;

    public StringFactor(StringPrimary stringPrimary, CollateClause collateClause) {
        this.beginIndex = stringPrimary.getBeginIndex();
        this.endIndex = collateClause != null ? collateClause.getEndIndex() : stringPrimary.getEndIndex();
        this.stringPrimary = stringPrimary;
        this.collateClause = collateClause;
    }

    @Override
    public int getBeginIndex() {
        return beginIndex;
    }

    @Override
    public int getEndIndex() {
        return endIndex;
    }

    public StringPrimary getStringPrimary() {
        return stringPrimary;
    }

    public CollateClause getCollateClause() {
        return collateClause;
    }

}
